package com.car.loan.framework.aspectj.impl;

import com.car.loan.common.enums.LoanStatusEnum;
import com.car.loan.common.utils.StringUtils;
import com.car.loan.framework.aspectj.DataStatusSqlService;
import com.car.loan.project.xr.util.bo.business.LoanBaseInfo;
import com.car.loan.project.xr.util.enums.BusinessApostilleStatus;
import com.car.loan.project.xr.util.enums.LoanBusinessAuditStatus;
import com.car.loan.project.xr.util.enums.RepaymentInfoStatus;
import com.car.loan.project.xr.util.enums.SettlementInfoStatus;
import org.springframework.stereotype.Service;

/**
 * @author huangding
 * @description 业务状态
 * @date 2019/11/9 16:07
 */
@Service
public class SearchBusinessListSqlServiceImpl implements DataStatusSqlService {

    @Override
    public LoanStatusEnum getLoanStatusEnum() {
        return LoanStatusEnum.SEARCH_BUSINESS_LIST;
    }

    @Override
    public LoanBaseInfo getStatusRemark(LoanBaseInfo loanBaseInfo) {
        return loanBaseInfo;
    }

    @Override
    public String getSql(String statusAlias, Integer status) {

        String sql = "({}.business_audit_status = " + LoanBusinessAuditStatus.PASS.status
            + " or {}.business_apostille_status=" + BusinessApostilleStatus.PASS.status
            + ")";
        return sql.replace("{}", statusAlias);
    }

    @Override
    public String getSortSql(String statusAlias) {
        return " order by {}.business_audit_time desc".replace("{}", statusAlias);
    }
}
